package org.sean.framework.kafka.logging.delivery;

import org.springframework.kafka.core.KafkaTemplate;

/**
 * Interface for DeliveryStrategies.
 *
 * @author xielei
 */
public interface DeliveryStrategy {

    /**
     * Sends a message to a kafka producer and somehow deals with failures.
     *
     * @param producer the backing kafka producer
     * @param topic    the prepared kafka topic
     * @param key      the prepared kafka key
     * @param value    the prepared kafka value
     * @return {@code true} if the message could be sent successfully, {@code false} otherwise.
     */
    boolean send(KafkaTemplate<Object, Object> producer, String topic, String key, String value);

}
